<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../vue.js"></script>
</head>

<body>
    <script>
        function queryData(url) {
            var p = new Promise(function(resolve, reject) {
                var xhr = new XMLHttpRequest();
                xhr.onreadystatechange = function() {
                    if (xhr.readyState != 4) {
                        return;

                    }
                    if (xhr.readyState == 4 && xhr.status == 200) {
                        resolve(xhr.responseText);
                    } else {
                        reject('服务器错误');
                    }
                }
                xhr.open('get', url);
                xhr.send(null);
            });
            return p;
        }
        queryData('http://localhost/travel/Jialong')
            .then(function(data) {
                console.log(data);
            }, function(info) {
                console.log(info);
            })
    </script>

</body>

</html>